{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 7.15 Power Required for Pumping"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Water at 70 deg F is pumped through a sketched system at a rate of 100 gal/min.\n",
    "\n",
    "Find the total discharge head brake horsepower for a pump with an efficiency of 70%.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "head = 420.3499305270172 foot\n",
      "power = 15.154490724520906 horsepower\n"
     ]
    }
   ],
   "source": [
    "from fluids.units import *\n",
    "from math import pi\n",
    "L = (30+100+70+300)*u.foot\n",
    "dH = 400*u.foot\n",
    "efficiency = 0.7\n",
    "\n",
    "Q = 100*u.gallon/u.min\n",
    "mu = 0.95*u.cP\n",
    "rho = 62.298*u.lb/u.ft**3\n",
    "\n",
    "NPS, Di, Do, t = nearest_pipe(Do=3*u.inch, schedule='40')\n",
    "\n",
    "Di_reducer = nearest_pipe(Do=2.5*u.inch, schedule='40')[1]\n",
    "\n",
    "A = 0.25*pi*Di**2\n",
    "v = Q/A\n",
    "Re = rho*v*Di/mu\n",
    "fd = friction_factor(Re=Re, eD=0.0022*u.inch/Di)\n",
    "\n",
    "K_exit = exit_normal()\n",
    "K_gate = K_gate_valve_Crane(D1=Di, D2=Di, angle=0.0*u.degrees)\n",
    "K_elbow = bend_rounded(Di=Di, angle=90*u.degrees, Re=Re, method='Crane standard')\n",
    "K_lift_valve = K_lift_check_valve_Crane(D1=Di_reducer, D2=Di, angled=False)\n",
    "\n",
    "K_tot = K_exit + K_gate + 4*K_elbow + K_lift_valve\n",
    "K_tot += K_from_f(fd=fd, L=L, D=Di)\n",
    "\n",
    "dP = dP_from_K(K=K_tot, rho=rho, V=v) + rho*dH*1*u.gravity\n",
    "dP.to(u.psi), v.to(u.foot/u.s)\n",
    "\n",
    "head = head_from_P(dP, rho).to(u.foot)\n",
    "print('head = %s' %head)\n",
    "power = Q*dP/efficiency\n",
    "print('power = %s' %(power.to(u.hp)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "The values given in Crane are 421 feet of head and 15.2 hp."
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
